/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uccart_project.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author KNO
 */
@Entity
@Table(name = "carrera")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Carrera.findAll", query = "SELECT c FROM Carrera c"),
    @NamedQuery(name = "Carrera.findByCarrCod", query = "SELECT c FROM Carrera c WHERE c.carrCod = :carrCod"),
    @NamedQuery(name = "Carrera.findByCarrNombre", query = "SELECT c FROM Carrera c WHERE c.carrNombre = :carrNombre")})
public class Carrera implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "carr_cod")
    private String carrCod;
    @Basic(optional = false)
    @Column(name = "carr_nombre")
    private String carrNombre;
    @OneToMany(mappedBy = "reqCarrera")
    private List<Requisito> requisitoList;
    @OneToMany(mappedBy = "planCarrera")
    private List<Plan> planList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "materiaCodcarrera")
    private List<Materia> materiaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "estCodcarrera")
    private List<Estudiante> estudianteList;

    public Carrera() {
    }

    public Carrera(String carrCod) {
        this.carrCod = carrCod;
    }

    public Carrera(String carrCod, String carrNombre) {
        this.carrCod = carrCod;
        this.carrNombre = carrNombre;
    }

    public String getCarrCod() {
        return carrCod;
    }

    public void setCarrCod(String carrCod) {
        this.carrCod = carrCod;
    }

    public String getCarrNombre() {
        return carrNombre;
    }

    public void setCarrNombre(String carrNombre) {
        this.carrNombre = carrNombre;
    }

    @XmlTransient
    public List<Requisito> getRequisitoList() {
        return requisitoList;
    }

    public void setRequisitoList(List<Requisito> requisitoList) {
        this.requisitoList = requisitoList;
    }

    @XmlTransient
    public List<Plan> getPlanList() {
        return planList;
    }

    public void setPlanList(List<Plan> planList) {
        this.planList = planList;
    }

    @XmlTransient
    public List<Materia> getMateriaList() {
        return materiaList;
    }

    public void setMateriaList(List<Materia> materiaList) {
        this.materiaList = materiaList;
    }

    @XmlTransient
    public List<Estudiante> getEstudianteList() {
        return estudianteList;
    }

    public void setEstudianteList(List<Estudiante> estudianteList) {
        this.estudianteList = estudianteList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (carrCod != null ? carrCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Carrera)) {
            return false;
        }
        Carrera other = (Carrera) object;
        if ((this.carrCod == null && other.carrCod != null) || (this.carrCod != null && !this.carrCod.equals(other.carrCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.uccart_project.model.Carrera[ carrCod=" + carrCod + " ]";
    }
    
}
